/**
 * @file
 *           base64.h
 * @brief
 *          <fillin>purpose
 *
 * @par Author (last changes):
 *          - Herea Adrian
 *          
 * @par Description:
 *
 *
 * @par Module-History:
 * @verbatim
 *  Date        Author				Reason
 *  15.01.2010  Herea Adrian         Initial creation
 *
 * @endverbatim
 *
 * @par Copyright Notice:
 * @verbatim
 * Copyright (C) 2010
 * All Rights Reserved.
 * The reproduction, transmission or use of this document or its contents is
 * not permitted without express written authority.
 * Offenders will be liable for damages. All rights, including rights created
 * by patent grant or registration of a utility model or design, are reserved.
 **/
#pragma once

#include <WinSock2.h>
#include <string>

#include "ReceiverListener.h"

static const char* MSG_BEGIN_TAG = "$$$$";
static const char* MSG_END_TAG = "####";

using namespace std;

class AbstractSocket
{
public:
  AbstractSocket(SOCKET winSocket);
  virtual
  ~AbstractSocket(void);
public:
  virtual void
  run() = 0;
  int
  protocolSend(string sProtocol);
  void
  protocolReceive(string sProtocol);
  void
  registerListener(ReceiverListener* pListener);
protected:
  int
  socketListen();
  int
  socketSelect(int iTimeOut = 250000);
protected:
  SOCKET m_winSocket;
  ReceiverListener* m_pListener;
  string m_sRecvMsgBuffer;
};
